#ifndef __RING_BUFFER_H
#define __RING_BUFFER_H


#define BUFFER_SIZE 1024        /* 环形缓冲区的大小 */
typedef struct
{
    unsigned char buffer[BUFFER_SIZE];  /* 缓冲区空间 */
    volatile unsigned int pW;           /* 写地址 */
    volatile unsigned int pR;           /* 读地址 */
} RingBuffer;



void RingBuffer_init(RingBuffer *SrcBuffer);
void RingBuffer_write(unsigned char c, RingBuffer *SrcBuffer);
int RingBuffer_read(unsigned char *c, RingBuffer *SrcBuffer);

#endif /* __RING_BUFFER_H */


